package yunjiao.javatutorials.mq.component;

import com.github.javafaker.Faker;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import yunjiao.javatutorials.mq.model.User;

import java.util.function.Supplier;

/**
 * 用户数据生成
 *
 * @author yangyunjiao
 */
@Component
@RequiredArgsConstructor
public class RandomUserSupplier implements Supplier<User> {
    private final Faker faker;

    @Override
    public User get() {
        return User.builder().id(faker.internet().uuid())
                .username(faker.name().firstName())
                .phone(faker.phoneNumber().phoneNumber())
                .email(faker.internet().emailAddress())
                .status(faker.number().numberBetween(1,3))
                .build();
    }
}
